package com.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sfzy.entity.Certificate;
import com.sfzy.entity.Chapters;
import com.sfzy.entity.ChargingStandards;
import com.sfzy.mapper.ChaptersMapper;
import com.sfzy.service.ChaptersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChaptersServiceImpl implements ChaptersService {
@Autowired
private ChaptersMapper chaptersMapper;

    @Override
    public int insertChapters(Chapters chapters) {
        return chaptersMapper.insertChapters(chapters);
    }

    @Override
    public int deleteChapters(int id) {
        return chaptersMapper.deleteChapters(id);
    }

    @Override
    public int updateChapters(Chapters chapters) {
        return chaptersMapper.updateChapters(chapters);
    }

    @Override
    public List<Chapters> selectChaptersById3(int id) {
        List<Chapters> chapters=chaptersMapper.selectChaptersById3(id);
        return chapters;
    }

    @Override
    public List<Chapters> selectAllChapters3(Chapters chapters) {
        return chaptersMapper.selectAllChapters3(chapters);
    }

    @Override
    public PageInfo<Chapters> selectChapters3(Chapters chapters, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Chapters> chapters1 = chaptersMapper.selectAllChapters3(chapters);
        PageInfo<Chapters> pageInfo = new PageInfo<>(chapters1);
        return pageInfo;
    }
}
